package indexes;

/**
 * A PlayerID is the relation between the alphanumeric ID and the
 * file offset.
 * @author bfults (Brian Fults - 905084698)
 *
 */
public class PlayerID implements Comparable<PlayerID>
{
    private String id;
    private long offset;
   
    /**
     * 
     * @param id alphanumeric id for this player.
     * @param offset int file offset for this id.
     */
    public PlayerID(String id, long offset)
    {
        this.id = id;
        this.offset = offset;
    }

    @Override
    /**
     * We only compare based on the key - if we compared
     * based on the offset, we would never be able to find the
     * player in a structure without knowing the offset beforehand.
     * @param otherID PlayerID being compared
     */
    public int compareTo( PlayerID otherID )
    {
        return this.id.compareTo(otherID.getId());
    }
    
    /**
     * Returns the alphanumeric id for this Player.
     * @return A string id.
     */
    public String getId()
    {
        return id;
    }
    
    /**
     * Returns the offset for this player.
     * @return A long file offset.
     */
    public long getOffset()
    {
        return offset;
    }
    
    public String toString()
    {
        return this.id + ": " + this.offset;
    }
}
